<?php

require_once '../constant/Config.php';
$mysql_server = Config::serveur;
$mysql_login = Config::user;
$mysql_password = Config::password;
$mysql_database = Config::database;

mysql_connect($mysql_server, $mysql_login, $mysql_password);
mysql_select_db($mysql_database);

$search = addslashes($_GET['term']);
$req="SELECT id,nom,prenom,date,sexe,club FROM runnerdata WHERE nom like upper('".$search."%') ORDER BY nom";
$query = mysql_query($req);
while($row = mysql_fetch_array($query))
{
	
	$date=explode("-",$row['date']);
	
	$results[] = array(
			'label' => $row['nom']." ".$row['prenom'],
			'value' => $row['nom'],
			'data' => array(
					'id'=>$row['id'],
					'nom'=>$row['nom'],
					'prenom'=>$row['prenom'],
					'y1'=>$date[0],
					'sexe'=>$row['sexe'],
					'club'=>$row['club']
				)
	);
	
	
	
}

echo json_encode($results);
?>



